//
//  MainView.m
//  IpadR
//
//  Created by edianzu on 2017/5/26.
//  Copyright © 2017年 ruilai. All rights reserved.
//

#import "MainView.h"

@implementation MainView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
-(instancetype)initWithFrame:(CGRect)frame{
    if ([super initWithFrame:frame]) {
        [self creatView];
    }
    return self;
}

-(void)creatView{
    self.backgroundColor =UIColorFromRGB(246, 246, 246);
    
    _myScrollView = [[UIScrollView alloc]init];
    _myScrollView.backgroundColor = UIColorFromRGB(246, 246, 246);
    _myScrollView.contentSize = CGSizeMake(0, 1000);
    _myScrollView.showsVerticalScrollIndicator=NO;
    [self addSubview:_myScrollView];
    [_myScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.mas_left);
        make.top.mas_equalTo(self.mas_top);
        make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT));
    }];
    
    _testProcessIMG = [[UIImageView alloc]init];
    _testProcessIMG.image = [UIImage imageNamed:@"testProcess"];
    [_myScrollView addSubview:_testProcessIMG];
    [_testProcessIMG mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(_myScrollView.mas_left).with.offset(60*AutoScaleHorizontal);
        make.top.mas_equalTo(_myScrollView.mas_top).with.offset(30*AutoScaleVertical);
        make.size.mas_equalTo(CGSizeMake(200*AutoScaleHorizontal, 100*AutoScaleVertical));
    }];
    
    _classNumIMG = [[UIImageView alloc]init];
    _classNumIMG.image = [UIImage imageNamed:@"classNum"];
    [_myScrollView addSubview:_classNumIMG];
    [_classNumIMG mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(_myScrollView.mas_left).with.offset(964*AutoScaleHorizontal);//此处，本来设置距离SCVIEW右侧，但不成功，原因有待查明
        make.top.mas_equalTo(_myScrollView.mas_top).with.offset(30*AutoScaleVertical);
        make.size.mas_equalTo(CGSizeMake(200*AutoScaleHorizontal, 100*AutoScaleVertical));
    }];
    
    _unTestIMG = [[UIImageView alloc]init];
    _unTestIMG.image = [UIImage imageNamed:@"unTest"];
    [_myScrollView addSubview:_unTestIMG];
    [_unTestIMG mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(_testProcessIMG.mas_right).with.offset(30*AutoScaleHorizontal);
        make.top.mas_equalTo(_myScrollView.mas_top).with.offset(30*AutoScaleVertical);
        make.size.mas_equalTo(CGSizeMake(200*AutoScaleHorizontal, 100*AutoScaleVertical));
    }];
    
    _schoolNumIMG = [[UIImageView alloc]init];
    _schoolNumIMG.image = [UIImage imageNamed:@"schoolNum"];
    [_myScrollView addSubview:_schoolNumIMG];
    [_schoolNumIMG mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(_classNumIMG.mas_left).with.offset(-30*AutoScaleHorizontal);
        make.top.mas_equalTo(_myScrollView.mas_top).with.offset(30*AutoScaleVertical);
        make.size.mas_equalTo(CGSizeMake(200*AutoScaleHorizontal, 100*AutoScaleVertical));
    }];
    
    _testProcessLabel = [[UILabel alloc]init];
    _testProcessLabel.text =@"75%";
    _testProcessLabel.textColor = [UIColor whiteColor];
    _testProcessLabel.font = [UIFont boldSystemFontOfSize:18*AutoScaleHorizontal];
    [_testProcessIMG addSubview:_testProcessLabel];
    [_testProcessLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(_testProcessIMG.mas_bottom).with.offset(-25*AutoScaleVertical);
        make.left.mas_equalTo(_testProcessIMG.mas_left).with.offset(80*AutoScaleHorizontal);
        make.size.mas_equalTo(CGSizeMake(100*AutoScaleHorizontal, 30*AutoScaleVertical));
    }];
    
    _classNumLabel = [[UILabel alloc]init];
    _classNumLabel.text =@"100";
    _classNumLabel.textColor = [UIColor whiteColor];
    _classNumLabel.font = [UIFont boldSystemFontOfSize:18*AutoScaleHorizontal];
    [_classNumIMG addSubview:_classNumLabel];
    [_classNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(_classNumIMG.mas_bottom).with.offset(-25*AutoScaleVertical);
        make.left.mas_equalTo(_classNumIMG.mas_left).with.offset(80*AutoScaleHorizontal);
        make.size.mas_equalTo(CGSizeMake(100*AutoScaleHorizontal, 30*AutoScaleVertical));
    }];
    _unTestLabel = [[UILabel alloc]init];
    _unTestLabel.text =@"1000";
    _unTestLabel.textColor = [UIColor whiteColor];
    _unTestLabel.font = [UIFont boldSystemFontOfSize:18*AutoScaleHorizontal];
    [_unTestIMG addSubview:_unTestLabel];
    [_unTestLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(_unTestIMG.mas_bottom).with.offset(-25*AutoScaleVertical);
        make.left.mas_equalTo(_unTestIMG.mas_left).with.offset(80*AutoScaleHorizontal);
        make.size.mas_equalTo(CGSizeMake(100*AutoScaleHorizontal, 30*AutoScaleVertical));
    }];
    _schoolNumLabel = [[UILabel alloc]init];
    _schoolNumLabel.text =@"1000";
    _schoolNumLabel.textColor = [UIColor whiteColor];
    _schoolNumLabel.font = [UIFont boldSystemFontOfSize:18*AutoScaleHorizontal];
    [_schoolNumIMG addSubview:_schoolNumLabel];
    [_schoolNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(_schoolNumIMG.mas_bottom).with.offset(-25*AutoScaleVertical);
        make.left.mas_equalTo(_schoolNumIMG.mas_left).with.offset(80*AutoScaleHorizontal);
        make.size.mas_equalTo(CGSizeMake(100*AutoScaleHorizontal, 30*AutoScaleVertical));
    }];
    
    _checkClassStatusLabel = [[UILabel alloc]init];
    _checkClassStatusLabel.text = @"查看各班情况";
    _checkClassStatusLabel.textColor = [UIColor blackColor];
    _checkClassStatusLabel.font = [UIFont systemFontOfSize:16*AutoScaleHorizontal];
    [_myScrollView addSubview:_checkClassStatusLabel];
    [_checkClassStatusLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(_testProcessIMG.mas_left);
        make.top.mas_equalTo(_testProcessIMG.mas_bottom).with.offset(40*AutoScaleVertical);
        make.size.mas_equalTo(CGSizeMake(150*AutoScaleHorizontal, 17*AutoScaleVertical));
    }];
    
    _chooseProjectBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [_chooseProjectBtn setImage:[UIImage imageNamed:@"choosePro"] forState:UIControlStateNormal];
    [_myScrollView addSubview:_chooseProjectBtn];
    [_chooseProjectBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(_classNumIMG.mas_right);
        make.top.mas_equalTo(_classNumIMG.mas_bottom).with.offset(40*AutoScaleVertical);
        make.size.mas_equalTo(CGSizeMake(100*AutoScaleHorizontal, 30*AutoScaleVertical));
    }];
}
@end
